﻿@page "/GridResizeColumns"
@layout DataProviderAccessArea<INwindDataProvider>

<DemoPageSectionComponent Id="DataGrid-ResizeColumns" ShowHorizontalScrollBar="true">
    <DemoChildContent>
        @inject NwindDataService NwindDataService

        <DxDataGrid DataAsync="@NwindDataService.GetCustomersAsync" ColumnResizeMode="@CurrentMode">
            <Columns>
                <DxDataGridColumn Field="@nameof(Customer.ContactName)" />
                <DxDataGridColumn Field="@nameof(Customer.CompanyName)" />
                <DxDataGridColumn Field="@nameof(Customer.City)" />
                <DxDataGridColumn Field="@nameof(Customer.Region)" />
                <DxDataGridColumn Field="@nameof(Customer.Country)" />
            </Columns>
        </DxDataGrid>
    </DemoChildContent>
    <OptionsContent>
        <OptionComboBox Label="Column Resize Mode:" Data="@Modes" @bind-Value="@CurrentMode" />
    </OptionsContent>

    @code {
        DataGridColumnResizeMode CurrentMode { get; set; } = DataGridColumnResizeMode.NextColumn;
        DataGridColumnResizeMode[] Modes { get; } = new DataGridColumnResizeMode[] {
            DataGridColumnResizeMode.NextColumn,
            DataGridColumnResizeMode.Component
        };
    }
</DemoPageSectionComponent>
